<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/admin/include/init_admin.jsp" %>
<%@ page import="com.joinhawaii.admin.product.*" %>
<%

	HashList code001	= CommonUtil.getCodeList("001");	//섬코드
	HashList code002	= CommonUtil.getCodeList("002");	//호텔구분


	String s_land_code		= StringUtil.nvl(request.getParameter("s_land_code"));
	String s_room_type		= StringUtil.nvl(request.getParameter("s_room_type"));
	String s_hotel_eng_name	= StringUtil.toHan(request.getParameter("s_hotel_eng_name"));


	HashMap infos = new HashMap();
	infos.put("land_code",	s_land_code);
	infos.put("room_type",	s_room_type);
	infos.put("hotel_eng_name",	s_hotel_eng_name);

	ProductDAO dao 	= new ProductDAO();
	HashList list 	= dao.selectHotelList(infos);

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>조인하와이</title>
	<%@ include file="/admin/include/cssnjs.jsp"  %>
	<script type="text/javascript">
	$(document).ready(function() {
		$('#s_name').focus().select();
		$('#list').find('tr').hover(
				function () { $(this).addClass("hover"); }
			  , function () { $(this).removeClass("hover"); }
			)
			.click(function(event){
				if (event.target.nodeName != 'INPUT') {
					$('#hotel_id').val($(this).attr('hotel_id'));
					$('#searchForm').attr('action', './hotelDetail.jsp?s_land_code=<%=s_land_code%>&s_room_type=<%=s_room_type%>&s_hotel_eng_name=<%=s_hotel_eng_name%>');
					$('#searchForm').submit();
				}
			});
	});


	function fnSave() {
		if (confirm("저장하시겠습니까?")) {
			$('#saveForm').attr('action', './hotelListSave.do?s_land_code=<%=s_land_code%>&s_room_type=<%=s_room_type%>&s_hotel_eng_name=<%=s_hotel_eng_name%>');
			$('#saveForm').submit();
		}
	}

	function fnNew() {
		$('#hotel_id').val('XXXXXX');
		$('#searchForm').attr('action', './hotelDetail.jsp?job_type=C');
		$('#searchForm').submit();
	}

	</script>
</head>
<body>
<div id="wrap">
	<div id="top">
		<%@ include file="/admin/include/top.jsp" %>
	</div>
	<div id="page">
		<div id="menu">
			<%@ include file="/admin/include/leftMenu.jsp" %>
		</div>
		<div id="contents">
			<div class="menu_title">
				<h1>할인호텔</h1>
				<p>관리자 > 상품관리 > <b>할인호텔</b></p>
			</div>
			<div class="clear line_01"></div>

			<form id="searchForm" method="post" action="./hotelList.jsp">
			<input type="hidden" name="hotel_id" id="hotel_id" value=""/>
			<table cellpadding="0" cellspacing="0" class="table_01 mt15">
			<colgroup>
				<col width="100px" />
				<col width="160px" />
				<col width="100px" />
				<col width="160px" />
				<col width="100px" />
				<col  />
			</colgroup>
			<tr>
			    <th><p>섬</p></th>
			    <td>
			    	<select name="s_land_code">
          	  	  	<option value="">전체</option>
          	  	  	<%= StringUtil.makeOption(code001, s_land_code) %>
				  	</select>
				</td>
				<th><p>호텔구분</p></th>
				<td >
					<select name="s_room_type">
          	  	  	<option value="">전체</option>
          	  	  	<%= StringUtil.makeOption(code002, s_room_type) %>
				 	</select>
				</td>
				<th><p>호텔명</p></th>
				<td class="brx">
					<input type="text" name="s_hotel_eng_name" id="s_hotel_eng_name" value="<%= s_hotel_eng_name %>" class="w120"/>
				</td>
			</tr>
			</table>

			<div class="mt10 mb10 r">
				<input type="image" src="/images/admin/btn_search.gif" class="button"/>
				<a href="#nohref" onclick="fnSave()"><img src="/images/admin/btn_save.gif"></a>
				<a href="#nohref" onclick="fnNew()"><img src="/images/admin/btn_new.gif"></a>
			</div>
			
			</form>

			<div class="search_result">검색결과 : <%= list.size() %>건</div>

			<form id="saveForm" method="post" action="./hotelListSave.do">
		    <table cellpadding="0" cellspacing="0" class="table_03">
				<colgroup>
					<col width="40px"/>
					<col width="60px"/>
					<col width="60px"/>
					<col width="280px"/>
					<col width="280px"/>
					<col width="60px"/>
					<col width="80px"/>
					<col width="60px"/>
					<col/>
				</colgroup>
				<thead>
					<tr>
						<th><p>No</p></th>
						<th><p>섬</p></th>
						<th><p>구분</p></th>
						<th><p>호텔명</p></th>
						<th><p>국문명</p></th>
						<th><p>객실수</p></th>
						<th><p>특가상품</p></th>
						<th><p>정렬</p></th>
						<th><p>사용여부</p></th>
					</tr>
				</thead>
				<tbody id="list">
			<%	for (int i = 0; i < list.size(); i++) { %>
					<tr hotel_id="<%= list.get("hotel_id",i) %>">
						<td>
							<%= list.size()-i %>
							<input type="hidden" name="list.hotel_id" value="<%= list.get("hotel_id", i) %>"/>
						</td>
						<td><%= list.get("land_code", i) %></td>
						<td><%= list.get("room_type", i) %></td>
						<td class="l"><%= list.get("hotel_eng_name", i) %></td>
						<td class="l"><%= list.get("hotel_kor_name", i) %></td>
						<td><%= list.get("room_cnt", i) %></td>
						<td><%= list.get("main_yn", i) %></td>
						<td><input type="text" name="list.sort_flag" value="<%= list.get("sort_flag", i) %>" class="w30 c" maxlength="4"/></td>
						<td><%= list.get("use_yn", i) %></td>
					</tr>
			<%	} %>
				</tbody>
			</table>
			</form>

			<div class="paging">

			</div>
		</div>
	</div>
</div>
</body>
</html>
